package com.yanqu.road.server.cmd.activity.hongxian;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.HongXianActivityProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.activity.hongxian.CrossHongXianActivity;
import com.yanqu.road.server.manager.activity.hongxian.CrossHongXianMgr;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.C_HONG_XIAN_NOTICE_UPLOAD, desc = "公告上传")
public class CrossHongXianNoticeUploadCmd extends CrossCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        HongXianActivityProto.HongXianUploadNoticeMsg noticeMsg = HongXianActivityProto.HongXianUploadNoticeMsg.parseFrom(packet.getBytes());

        CrossHongXianActivity activity = CrossHongXianMgr.getHongXianActivity(noticeMsg.getActivityId());
        if(activity != null){
            activity.addDrawNotice(serverId, packet.getPlayerId(), noticeMsg.getNoticeList());
        }
    }

    @Override
    public void sendData() {

    }
}
